import React, { Component } from 'react'
import { connect } from 'react-redux'
import {
  addUser
} from './store/actions/userAction'

const p = state => ({
  user: state.user
})

@connect(p, {addUser})
class App extends Component {

  addUser = () => {
    // 发送给saga中间件
    this.props.addUser()
  }

  render() {
    console.log(this.props.user);
    return (
      <div>
        <button onClick={this.addUser}>添加用户</button>
      </div>
    );
  }
}

export default App